home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / basic / ace24dist.lha / ace24.lha / include / libraries / commodities.h < prev    next >
C/C++ Source or Header  |  1996-09-10  |  7KB  |  223 lines

  1. #ifndef LIBRARIES_COMMODITIES_H
  2. #define LIBRARIES_COMMODITIES_H 1
  3. /*
  4. ** commodities.h for ACE Basic
  5. **
  6. ** Note: Translated to ACE by ConvertC2ACE
  7. **       @ MapMeadow Software, Nils Sjoholm
  8. **
  9. **
  10. ** Date: 09/01/95
  11. **
  12. **
  13. */
  14.  
  15. /*
  16. ** This are the StructPointer defines for commodities.h
  17. */
  18. #ifndef InputXpressionPtr
  19. #define InputXpressionPtr ADDRESS
  20. #endif
  21. #ifndef NewBrokerPtr
  22. #define NewBrokerPtr ADDRESS
  23. #endif
  24. /*
  25. ** End of StructPointer defines for commodities.h
  26. */
  27.  
  28.  
  29. /*****************************************************************************/
  30.  
  31.  
  32. #ifndef EXEC_TYPES_H
  33. #include <exec/types.h>
  34. #endif
  35.  
  36. #ifndef EXEC_PORTS_H
  37. #include <exec/ports.h>
  38. #endif
  39.  
  40.  
  41. /*****************************************************************************/
  42.  
  43.  
  44. /* object creation macros */
  45. /*
  46. #define CxFilter(d)     CreateCxObj((LONGINT) CX_FILTER,      (LONGINT) d,      0)
  47. #define CxSender(port, id)   CreateCxObj((LONGINT) CX_SEND,        (LONGINT) port,   (LONGINT) id)
  48. #define CxSignal(task, sig)  CreateCxObj((LONGINT) CX_SIGNAL,      (LONGINT) task,   (LONGINT) sig)
  49. #define CxTranslate(ie)     CreateCxObj((LONGINT) CX_TRANSLATE,   (LONGINT) ie,     0)
  50. #define CxDebug(id)     CreateCxObj((LONGINT) CX_DEBUG,       (LONGINT) id,     0)
  51. #define CxCustom(action, id) CreateCxObj((LONGINT) CX_CUSTOM,      (LONGINT)action,  (LONGINT)id)
  52. */
  53.  
  54. /*****************************************************************************/
  55.  
  56.  
  57. STRUCT NewBroker
  58.  
  59.     BYTE        nb_Version    /* Must be set to NB_VERSION */
  60.     ADDRESS      nb_Name 
  61.     ADDRESS      nb_Title 
  62.     ADDRESS      nb_Descr 
  63.     SHORTINT        nb_Unique 
  64.     SHORTINT        nb_Flags 
  65.     BYTE        nb_Pri 
  66.     MsgPortPtr  nb_Port 
  67.     SHORTINT        nb_ReservedChannel 
  68. END STRUCT 
  69.  
  70. /* constant for NewBroker.nb_Version */
  71. #define NB_VERSION 5        /* Version of NewBroker structure */
  72.  
  73. /* Sizes for various buffers */
  74. #define CBD_NAMELEN  24
  75. #define CBD_TITLELEN 40
  76. #define CBD_DESCRLEN 40
  77.  
  78. /* Flags for NewBroker.nb_Unique */
  79. #define NBU_DUPLICATE 0
  80. #define NBU_UNIQUE    1        /* will not allow duplicates       */
  81. #define NBU_NOTIFY    2        /* sends CXM_UNIQUE to existing broker */
  82.  
  83. /* Flags for NewBroker.nb_Flags */
  84. #define COF_SHOW_HIDE 4
  85.  
  86.  
  87. /*****************************************************************************/
  88.  
  89.  
  90. /* Fake data types for system private objects */
  91. #ifndef COMMODITIES_BASE_H
  92. #define CxObj LONGINT 
  93. #define CxMsg LONGINT 
  94. #endif
  95.  
  96. /* Pointer TO a FUNCTION returning a LONGINT */
  97. /*
  98. _def _LONGINT *PFL 
  99. */
  100.  
  101. /*****************************************************************************/
  102.  
  103.  
  104. /* Commodities object types */
  105. #define CX_INVALID  0     /* not a valid object (probably null) */
  106. #define CX_FILTER   1     /* input event messages only      */
  107. #define CX_TYPEFILTER   2     /* obsolete,  do not use           */
  108. #define CX_SEND 3     /* sends a message            */
  109. #define CX_SIGNAL   4     /* sends a signal         */
  110. #define CX_TRANSLATE    5     /* translates input event into chain  */
  111. #define CX_BROKER   6     /* application representative     */
  112. #define CX_DEBUG    7     /* dumps info to serial port      */
  113. #define CX_CUSTOM   8     /* application provides function      */
  114. #define CX_ZERO 9     /* system terminator node     */
  115.  
  116.  
  117. /*****************************************************************************/
  118.  
  119.  
  120. /* Commodities message types */
  121. #define CXM_IEVENT  (32)
  122. #define CXM_COMMAND (64)
  123.  
  124. /* Only CXM_IEVENT messages are passed through the input network. Other types
  125.  * of messages are sent to an optional port in your broker. This means that
  126.  * you must test the message type in your message handling,  if input messages
  127.  * and command messages come to the same port.
  128.  *
  129.  * CXM_IEVENT: Messages of this type rattle around the Commodities input
  130.  *         network. They are sent to you by a Sender object,  and passed
  131.  *         to you as a synchronous function call by a Custom object.
  132.  *
  133.  *         The message port or function entry point is stored in the
  134.  *         object,  and the ID field of the message will be set to what
  135.  *         you arrange issuing object.
  136.  *
  137.  *         The data section of the message will point to the input event
  138.  *         triggering the message.
  139.  *
  140.  * CXM_COMMAND: These messages are sent to a port attached to your Broker.
  141.  *      They are sent to you when the controller program wants your
  142.  *      program to do something. The ID value identifies the command.
  143.  */
  144.  
  145. /* ID values associated with a message of type CXM_COMMAND */
  146. #define CXCMD_DISABLE   (15)  /* please disable yourself     */
  147. #define CXCMD_ENABLE    (17)  /* please enable yourself  */
  148. #define CXCMD_APPEAR    (19)  /* open your window,  if you can    */
  149. #define CXCMD_DISAPPEAR (21)  /* go dormant          */
  150. #define CXCMD_KILL  (23)  /* go away for good        */
  151. #define CXCMD_LIST_CHG  (27)  /* Someone changed the broker list */
  152. #define CXCMD_UNIQUE    (25)  /* someone tried to create a broker
  153.                    * with your name. Suggest you appear.
  154.                    */
  155.  
  156.  
  157. /*****************************************************************************/
  158.  
  159.  
  160. STRUCT InputXpression
  161.  
  162.     BYTE  ix_Version      /* must be set to IX_VERSION */
  163.     BYTE  ix_Class    /* class must match exactly  */
  164.  
  165.     SHORTINT ix_Code     /* Bits that we want */
  166.     SHORTINT ix_CodeMask     /* Set bits here to indicate which bits in ix_Code
  167.                * are don't care bits.
  168.                */
  169.     SHORTINT ix_Qualifier    /* Bits that we want */
  170.     SHORTINT ix_QualMask     /* Set bits here to indicate which bits in
  171.                * ix_Qualifier are don't care bits
  172.                */
  173.     SHORTINT ix_QualSame     /* synonyms in qualifier */
  174. END STRUCT 
  175. /*
  176. typedef STRUCT InputXpression IX 
  177. */
  178.  
  179. /* constant for InputXpression.ix_Version */
  180. #define IX_VERSION 2
  181.  
  182. /* constants for InputXpression.ix_QualSame */
  183. #define IXSYM_SHIFT 1   /* left- and right- shift are equivalent     */
  184. #define IXSYM_CAPS  2   /* either shift or caps lock are equivalent  */
  185. #define IXSYM_ALT   4   /* left- and right- alt are equivalent       */
  186.  
  187. #define IXSYM_SHIFTMASK (IEQUALIFIER_LSHIFT OR IEQUALIFIER_RSHIFT)
  188. #define IXSYM_CAPSMASK  (IXSYM_SHIFTMASK OR IEQUALIFIER_CAPSLOCK)
  189. #define IXSYM_ALTMASK   (IEQUALIFIER_LALT OR IEQUALIFIER_RALT)
  190.  
  191. /* constant for InputXpression.ix_QualMask */
  192. #define IX_NORMALQUALS  &H7FFF   /* avoid RELATIVEMOUSE */
  193.  
  194. /* matches nothing */
  195. /*
  196. #define NULL_IX(ix)   ((ix)->ix_Class == IECLASS_NULL)
  197. */
  198.  
  199. /*****************************************************************************/
  200.  
  201.  
  202. /* Error returns from CxBroker() */
  203. #define CBERR_OK      0  /* No error                   */
  204. #define CBERR_SYSERR  1  /* System error,  no memory,  etc       */
  205. #define CBERR_DUP     2  /* uniqueness violation           */
  206. #define CBERR_VERSION 3  /* didn't understand NewBroker.nb_Version */
  207.  
  208.  
  209. /*****************************************************************************/
  210.  
  211.  
  212. /* Return values from CxObjError() */
  213. #define COERR_ISNULL     1   /* you called CxObjError(NULL)    */
  214. #define COERR_NULLATTACH 2   /* someone attached NULL to my list   */
  215. #define COERR_BADFILTER  4   /* a bad filter description was given */
  216. #define COERR_BADTYPE    8   /* unmatched type-specific operation  */
  217.  
  218.  
  219. /*****************************************************************************/
  220.  
  221.  
  222. #endif /* LIBRARIES_COMMODITIES_H */
  223.